package cn.puge.usercenter.utils;

import java.util.Random;

/**
 * @author LIJW
 * @date 2020/9/8 9:53
 */
public class SaltUtils {

    public static String getSalt(int n){


        char[] chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz01234567890!@#$%^&*()".toCharArray();

        //创建动态字符串
        StringBuilder stringBuilder = new StringBuilder();
        for (int i = 0; i < n ; i++) {
            char aChar = chars[new Random().nextInt(chars.length)];
            stringBuilder.append(aChar);
        }

        return stringBuilder.toString();
    }
}
